<template>
  <div>
    <label :for="item" v-for="(item, index) in arr" :key="index">
      <input type="checkbox" v-model="checkNum" :value="item" />
      {{ item }}</label
    >

    <p>你选择的累加和为：{{ sum }}</p>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: [9, 15, 19, 25, 29, 31, 48, 57, 62, 79, 87],
      checkNum: [],
    };
  },
  computed: {
    sum() {
      return this.checkNum.reduce((sum, item) => (sum += item), 0);
    },
  },
};
</script>

<style></style>
